﻿@model IEnumerable<KM.ENT.entSanPham>

@{
    ViewBag.Title = "DanhSachSlide";
    Layout = "~/Areas/Admin/Views/Shared/MasterAdmin.cshtml";
}
@using (Html.BeginForm("dsSanPham", "sanpham"))
{

    <div class="row">
        <div class="col-lg-12">
            <div class="box">
                <div class="box-header" data-original-title="">
                    <h2><i class="fa fa-user"></i><span class="break"></span>Slider</h2>
                    <div class="box-icon">
                        <a href="table.html#" class="btn-setting"><i class="fa fa-wrench"></i></a>
                        <a href="table.html#" class="btn-minimize"><i class="fa fa-chevron-up"></i></a>
                        <a href="table.html#" class="btn-close"><i class="fa fa-times"></i></a>
                    </div>
                </div>
                <div class="box-content">
                    <div id="DataTables_Table_0_wrapper" class="dataTables_wrapper form-inline" role="grid">
                        <div class="row">
                            <div class="col-lg-6">
                                <div id="DataTables_Table_0_length" class="dataTables_length">
                                    @Html.ActionLink("Thêm mới", "edit", new { Id = "" }, new { @class = "btn btn-sm btn-primary" })
                                    <button class="btn btn-sm btn-warning">Cập nhật</button>
                                    <button class="btn btn-sm btn-danger">Xóa</button>
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="dataTables_filter" id="DataTables_Table_0_filter">
                                    <label>
                                        Search:
                                        <input type="text" id="txt_search" aria-controls="DataTables_Table_0">
                                    </label>
                                </div>
                            </div>
                        </div>
                        <table class="table table-striped table-bordered bootstrap-datatable datatable dataTable" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
                            <thead>
                                <tr role="row">
                                    <th><input type="checkbox" id="chkSelectAll"></th>
                                    <th class="sorting_asc" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Username: activate to sort column descending">Tiêu đề</th>
                                    <th class="sorting_asc" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1">Ảnh sản phẩm</th>
                                    <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Status: activate to sort column ascending">Thứ tự</th>
                                    <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Actions: activate to sort column ascending">Chức năng</th>
                                </tr>
                            </thead>

                            <tbody id="t" role="alert" aria-live="polite" aria-relevant="all">
                                @{
                                    int i = 0;
                                    string className = "";
                                    foreach (var item in Model)
                                    {
                                        i++;
                                        className = (i % 2 == 0 ? "odd" : "even");
                                        <tr class="@className">
                                            <th><input id="ch" type="checkbox" /> </th>
                                            <td class=" sorting_1">@item.TenSanPham</td>
                                            <td class=" sorting_1"><img src="/images/@item.Image" style="width:90px; height:90px; margin-top:5px;"></td>
                                            <td class=" sorting_1">@Html.TextBoxFor(m => item.ThuTu)</td>

                                            <td class=" ">
                                                <a class="btn btn-success" href="table.html#">
                                                    <i class="fa fa-search-plus "></i>
                                                </a>

                                                <a class="btn btn-info" href="@Url.Action("edit", new {Id=item.Id })">
                                                    <i class="fa fa-edit "></i>
                                                </a>
                                                <a class="btn btn-danger" href="@Url.Action("DeleteSlide", new { Id = item.Id })">
                                                    <i class="fa fa-trash-o "></i>
                                                </a>
                                            </td>
                                        </tr>
                                    }

                                }

                            </tbody>
                        </table>

                    </div>
                </div>
            </div>
        </div>
        <!--/col-->

    </div>
}
@section java
    {
    <!--JavaScript-->
<script type="text/javascript">
        $(document).ready(function () {
            $("#txt_search").keypress(function (e) {

                if (e.which == 13) {
                    window.location.href = "@(Url.Action("edit","sanpham"))" + "/" + $(this).val();

                    return false;
                }
            });
        });

</script>
}



